package cc.geguol.iodemo.filestream;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;

/**
 * 作者：13687
 * 日期：2017/6/17
 * 项目：IODemo
 * 描述：二进制文件流的读取
 */
public class FileStream {
	public static void main(String[] args) throws IOException {
		copyPic();
	}

	/**
	 * 复制图片
	 * */
	private static void copyPic() throws IOException {
		FileInputStream fileInputStream = new FileInputStream("./img/iofamily.png");
		FileOutputStream fileOutputStream = new FileOutputStream("cp.png");
//      png size :68840
		System.out.println("png size :"+fileInputStream.available());

		byte[] bytes = new byte[1024];// 1kb
		while (fileInputStream.read(bytes)!=-1){
			// 写文件
			fileOutputStream.write(bytes,0,bytes.length);
		}

		fileInputStream.close();
		fileOutputStream.close();




	}
}
